#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "mcmcException.h"

////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
// out of bound exception

// constructor and destructor
XPT_OutOfBound::XPT_OutOfBound()
{
	p_description = new char[1];
	p_description[0] = '\0';
}

XPT_OutOfBound::XPT_OutOfBound(const char *pdes)
{
	if (pdes != NULL)
	{
		int aa=strlen(pdes);
		p_description = new char[strlen(pdes)+1];
		strcpy(p_description, pdes);
	}
	else
	{
		p_description = new char[1];
		p_description[0] = '\0';
	}
}

XPT_OutOfBound::~XPT_OutOfBound()
{
	if (p_description != NULL)
	{
		delete []p_description;
		p_description = NULL;
	}
}

// operator
XPT_OutOfBound& XPT_OutOfBound::operator=(const XPT_OutOfBound &a)
{
	if (this != &a)
	{
		if (p_description != NULL)
		{
			delete []p_description;
			p_description = NULL;
		}

		if (a.p_description != NULL)
		{
			p_description = new char[strlen(a.p_description)+1];
			strcpy(p_description, a.p_description);
		}
		else
		{
			p_description = new char[1];
			p_description[0] = '\0';
		}
	}
	return *this;
}

// operations
char* XPT_OutOfBound::GetDescription(void)
{
	if (p_description==NULL)
	{
		p_description = new char[1];
		p_description[0] = '\0';
		return p_description;
	}
	else
		return p_description;
}






